home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 27.zip / BS1 part 27 / VisionaleV1.1-D1.adf / virx / RotateVertices.virx < prev    next >
Text File  |  1992-10-30  |  1KB  |  68 lines

  1. /*
  2.  * RotateVertices.virx
  3.  * Copyright (c)1992 Bruno Costa & Lucia Darsa
  4.  */
  5.  
  6. options results
  7.  
  8. signal on HALT
  9. signal on SYNTAX
  10. signal on FAILURE
  11.  
  12. call openmath
  13.  
  14. lockgui
  15.  
  16. form = '"BOOL,TO Window,0|'    ||,
  17.        'STR,Angle:,10.0,6"'
  18.  
  19. requestform TITLE '"Rotate Vertices"' form
  20. if rc >= 5 then
  21.   signal halt
  22.  
  23. parse var result window '|' theta
  24. pi = 3.14159
  25. thetar = ((-theta) * pi) / 180
  26. costheta = cos(thetar)
  27. sintheta = sin(thetar)
  28.  
  29. if window = 0 then
  30.   winname = 'FROM'
  31. else
  32.   winname = 'TO'
  33.  
  34. getcenterselected winname
  35. parse var result cx cy
  36.  
  37. transformpoints winname costheta (-sintheta) (cx - cx * costheta + cy * sintheta),
  38.                         sintheta costheta (cy - cy * costheta - cx * sintheta),
  39.                         0 0 1
  40.  
  41. unlockgui
  42. exit 0
  43.  
  44. /* add rexxmathlib.library if it is not already open */
  45. openmath: procedure
  46.  if ~show('L', "rexxmathlib.library") then do
  47.    if ~addlib("rexxmathlib.library", 0, -30, 0) then do
  48.      requestnotify "could not open rexxmathlib.library"
  49.      exit 20
  50.    end
  51.  end
  52.  return
  53.  
  54. BREAK_C:
  55. HALT:
  56.  unlockgui
  57.  exit 20
  58.  
  59. FAILURE:
  60.  requestnotify '"Host *"'address()'*" returned an error (severity 'rc')*nexecuting' compress(sourceline(2),'* ') 'at line' SIGL'"'
  61.  unlockgui
  62.  exit 20
  63.  
  64. SYNTAX:
  65.  requestnotify '"'errortext(rc)'*nexecuting' compress(sourceline(2),'* ') 'at line' SIGL'"'
  66.  unlockgui
  67.  exit 20
  68.